package io.zsy.producer;

import io.zsy.channel.DefaultSource;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 约定大于配置测试
 *
 * @author: zhangshuaiyin
 * @date: 2021/12/22 21:54
 */
@Component
@EnableBinding(DefaultSource.class)
public class DefaultProducer {
    @Resource
    DefaultSource defaultSource;

    /**
     * 发送消息
     *
     * @param message message
     */
    public void send(String message) {
        defaultSource.output().send(MessageBuilder.withPayload(message).build());
    }

}
